'''
Created on 28 sept. 2010
@author: Marc CARRE
@contact: carre.marc@gmail.com
@license: GNU GPLv3
@version: 1.0
'''

import unittest
from FileWriter import FileWriter

class FileWriterTest(unittest.TestCase):

    def testWriteArrayInt(self):
        filePath = "test.txt"
        writer = FileWriter(filePath)
        writer.write([0,1], "A")
        writer.close()
        file = open(filePath, 'r')
        self.assertEquals("[0, 1] : ""A""\n", file.readline())

    def testWriteArrayFloat(self):
        filePath = "test.txt"
        writer = FileWriter(filePath)
        writer.write([3.5,8.88], "B")
        writer.close() 
        file = open(filePath, 'r')
        self.assertEquals("[3.5, 8.88] : ""B""\n", file.readline())

if __name__ == "__main__":
    unittest.main()